/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package dao;

import dto.Item;
import java.util.ArrayList;

/**
 *
 * @author aptech
 */
public class ItemDAO {

    public ArrayList<Item> listItem = null;

    public ItemDAO() {
        listItem = new ArrayList<Item>();
        listItem.add(new Item("i001", "Java", "Java programming", 4));
        listItem.add(new Item("i002", "C#", "C# programming", 5));
    }

    public Item getByCode(String code) {
        for (Item item : listItem) {
            if (item.getCode().equals(code)) {
                return item;
            }
        }
        return null;
    }
}
